%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/conditions/archived-forum-inherited-messages.defer-2"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 9, 10, 68, 69, 11, 13, 28<br />2: PgSelectInlineApply[62]<br />3: PgSelect[8]<br />ᐳ: Access[63]<br />4: PgSelectRows[14]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 63, 11<br /><br />ROOT __Item{1}ᐸ14ᐳ[15]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 16, 63, 15, 11<br /><br />ROOT PgSelectSingle{1}ᐸforumsᐳ[16]<br />1: <br />ᐳ: 17, 64, 65<br />2: Connection[24]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 24, 65, 11<br /><br />ROOT Connection{2}ᐸ65ᐳ[24]"):::bucket
    Bucket4("Bucket 4 (defer)<br />Deps: 38, 29, 11, 24"):::bucket
    Bucket7("Bucket 7 (listItem)<br />Deps: 38, 11<br /><br />ROOT __Item{7}ᐸ29ᐳ[34]"):::bucket
    Bucket8("Bucket 8 (nullableBoundary)<br />Deps: 35, 11<br /><br />ROOT PgSelectSingle{7}ᐸmessagesᐳ[35]<br />1: <br />ᐳ: 37, 40<br />2: PgSelect[41]<br />3: PgSelectRows[46]<br />ᐳ: First[45], PgSelectSingle[47]"):::bucket
    Bucket9("Bucket 9 (nullableBoundary)<br />Deps: 36, 35, 11, 39<br /><br />ROOT Edge{7}[36]"):::bucket
    Bucket10("Bucket 10 (nullableBoundary)<br />Deps: 47<br /><br />ROOT PgSelectSingle{8}ᐸusersᐳ[47]"):::bucket
    Bucket11("Bucket 11 (nullableBoundary)<br />Deps: 35, 11<br /><br />ROOT PgSelectSingle{7}ᐸmessagesᐳ[35]<br />1: <br />ᐳ: 50, 52<br />2: PgSelect[53]<br />3: PgSelectRows[58]<br />ᐳ: First[57], PgSelectSingle[59]"):::bucket
    Bucket12("Bucket 12 (nullableBoundary)<br />Deps: 59<br /><br />ROOT PgSelectSingle{11}ᐸusersᐳ[59]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket4
    Bucket4 --> Bucket7
    Bucket7 --> Bucket8 & Bucket9
    Bucket8 --> Bucket10
    Bucket9 --> Bucket11
    Bucket11 --> Bucket12

    %% plan dependencies
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸforumsᐳ<br />More deps:<br />- Object[11]"]]:::plan
    Lambda13{{"Lambda[13∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'EXCLUSIVELY' ]ᐳ[68]"}}:::plan
    PgSelectInlineApply62["PgSelectInlineApply[62∈0] ➊"]:::plan
    Lambda13 & PgSelectInlineApply62 --> PgSelect8
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 3"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect8 --> PgSelectRows14
    Lambda28{{"Lambda[28∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[69]"}}:::plan
    Lambda28 --> PgSelectInlineApply62
    Access63{{"Access[63∈0] ➊<br />ᐸ8.m.subqueryDetailsFor20ᐳ"}}:::plan
    PgSelect8 --> Access63
    __Item15[/"__Item[15∈1]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸforumsᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    List64{{"List[64∈2]<br />ᐸ63,15ᐳ"}}:::plan
    Access63 & __Item15 --> List64
    PgClassExpression17{{"PgClassExpression[17∈2]<br />ᐸ__forums__.”name”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression17
    Connection24[["Connection[24∈2]<br />ᐸ65ᐳ"]]:::plan
    Lambda65{{"Lambda[65∈2]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda65 --> Connection24
    List64 --> Lambda65
    ConnectionItems29[["ConnectionItems[29∈3]"]]:::plan
    Connection24 --> ConnectionItems29
    Access38{{"Access[38∈3]<br />ᐸ65.cursorDetailsᐳ"}}:::plan
    Lambda65 --> Access38
    Edge36{{"Edge[36∈7]"}}:::plan
    __Item34[/"__Item[34∈7]<br />ᐸ29ᐳ"\]:::itemplan
    PgCursor39{{"PgCursor[39∈7]"}}:::plan
    __Item34 & PgCursor39 --> Edge36
    __Item34 & Access38 --> PgCursor39
    ConnectionItems29 ==> __Item34
    PgSelectSingle35{{"PgSelectSingle[35∈7]<br />ᐸmessagesᐳ"}}:::plan
    __Item34 --> PgSelectSingle35
    PgSelect41[["PgSelect[41∈8]<br />ᐸusersᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression40{{"PgClassExpression[40∈8]<br />ᐸ__messages...author_id”ᐳ"}}:::plan
    PgClassExpression40 --> PgSelect41
    PgClassExpression37{{"PgClassExpression[37∈8]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle35 --> PgClassExpression37
    PgSelectSingle35 --> PgClassExpression40
    First45{{"First[45∈8]"}}:::plan
    PgSelectRows46[["PgSelectRows[46∈8]"]]:::plan
    PgSelectRows46 --> First45
    PgSelect41 --> PgSelectRows46
    PgSelectSingle47{{"PgSelectSingle[47∈8]<br />ᐸusersᐳ"}}:::plan
    First45 --> PgSelectSingle47
    PgClassExpression49{{"PgClassExpression[49∈10]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle47 --> PgClassExpression49
    PgClassExpression51{{"PgClassExpression[51∈10]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression49 o--o PgClassExpression51
    PgSelect53[["PgSelect[53∈11]<br />ᐸusersᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression52{{"PgClassExpression[52∈11]<br />ᐸ__messages...author_id”ᐳ"}}:::plan
    PgClassExpression52 --> PgSelect53
    PgClassExpression50{{"PgClassExpression[50∈11]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgClassExpression37 o--o PgClassExpression50
    PgSelectSingle35 --> PgClassExpression52
    First57{{"First[57∈11]"}}:::plan
    PgSelectRows58[["PgSelectRows[58∈11]"]]:::plan
    PgSelectRows58 --> First57
    PgSelect53 --> PgSelectRows58
    PgSelectSingle59{{"PgSelectSingle[59∈11]<br />ᐸusersᐳ"}}:::plan
    First57 --> PgSelectSingle59
    PgClassExpression60{{"PgClassExpression[60∈12]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle59 --> PgClassExpression60
    PgClassExpression61{{"PgClassExpression[61∈12]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression60 o--o PgClassExpression61

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Lambda13,PgSelectRows14,Lambda28,PgSelectInlineApply62,Access63 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression17,Connection24,List64,Lambda65 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,ConnectionItems29,Access38 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4 bucket4
    classDef bucket7 stroke:#808000
    class Bucket7,__Item34,PgSelectSingle35,Edge36,PgCursor39 bucket7
    classDef bucket8 stroke:#dda0dd
    class Bucket8,PgClassExpression37,PgClassExpression40,PgSelect41,First45,PgSelectRows46,PgSelectSingle47 bucket8
    classDef bucket9 stroke:#ff0000
    class Bucket9 bucket9
    classDef bucket10 stroke:#ffff00
    class Bucket10,PgClassExpression49,PgClassExpression51 bucket10
    classDef bucket11 stroke:#00ffff
    class Bucket11,PgClassExpression50,PgClassExpression52,PgSelect53,First57,PgSelectRows58,PgSelectSingle59 bucket11
    classDef bucket12 stroke:#4169e1
    class Bucket12,PgClassExpression60,PgClassExpression61 bucket12

